//
//  RSSystemUtit.m
//  RSToolNSObject
//
//  Created by thinkjoy on 16/10/26.
//  Copyright © 2016年 Thinkjoy_RS. All rights reserved.
//

#import "RSSystemUtit.h"

#import <MessageUI/MessageUI.h>

@implementation RSSystemUtit


#pragma mark    发送短信
+ (MFMessageComposeViewController *)sendSMS:(NSString *)bodyOfMessage
                              recipientList:(NSArray *)recipients
                                   delegate:(UIViewController<MFMessageComposeViewControllerDelegate> *)delegate

{
    MFMessageComposeViewController *megVC = [[MFMessageComposeViewController alloc] init];
    if([MFMessageComposeViewController canSendText]) {
        
        megVC.body = bodyOfMessage;
        if (recipients != nil) {
            megVC.recipients = recipients;
        }
        
        megVC.messageComposeDelegate = delegate;
        [delegate presentViewController:megVC animated:YES completion:^{ }];
    }
    return megVC;
}


#pragma mark    当前应用版本号
+ (NSString *)applicationVersion;
{
    return [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"];
}

#pragma mark    屏幕截图
+ (UIImage *)screenShotWithView:(UIView *)v;
{
    UIGraphicsBeginImageContext(v.frame.size);
    [v.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;
}
































@end
